package com.aidex.system.service.impl;

import com.aidex.common.core.service.BaseServiceImpl;
import com.aidex.common.core.text.Convert;
import com.aidex.common.utils.JsonHelper;
import com.aidex.common.utils.StringUtils;
import com.aidex.common.utils.http.HttpUtils;
import com.aidex.risk.domain.*;
import com.aidex.system.domain.*;
import com.aidex.system.event.LogEvent;
import com.aidex.system.mapper.AgentMapper;
import com.aidex.system.mapper.WaybillMapper;
import com.aidex.system.service.*;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.github.pagehelper.PageInfo;
import com.ibm.mq.jms.MQQueueConnectionFactory;
import com.ibm.msg.client.wmq.WMQConstants;
import org.redisson.api.RTopic;
import org.redisson.api.RedissonClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.PostConstruct;
import javax.jms.*;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * 运单管理Service业务层处理
 * @author jmy
 * @email jmyinjg@163.com
 * @date 2021-10-04
 */
@Service
@Transactional(readOnly = false)
public class WaybillServiceImpl extends BaseServiceImpl<WaybillMapper, Waybill> implements WaybillService
{
    private static final Logger log = LoggerFactory.getLogger(WaybillServiceImpl.class);

    private static final String BASE_URL = "http://10.80.33.208:7080/dmz_proxy/ESBService/HRDEVAD";

    private static final String BASE1_URL = "http://10.80.33.208:7080/ESBService/HRDEVAD";
    @Autowired
    private NlpService nlpService;
    @Autowired
    private CargoDetailService cargoDetailService;
    @Autowired
    private WaybillDetailService waybillDetailService;
    @Autowired
    private SyncEmergencyFlightService syncEmergencyFlightService;

    @Autowired
    private AgentService agentService;

    @Autowired(required = false)
    private AgentMapper agentMapper;
    @Autowired
    private RedissonClient redissonClient;
    @Autowired
    private VCsisBusinessAsdService vCsisBusinessAsdService;
    @Autowired
    private VCsisBusinessRecordService vCsisBusinessRecordService;
    @Autowired
    private VCsisBusinessUnpackingService vCsisBusinessUnpackingService;
    @Autowired
    private VCsisBusinessReleaseService vCsisBusinessReleaseService;
    @Autowired
    private ApplicationEventPublisher publisher;
    @Autowired
    private SpecialCodeService specialCodeService;

    @Value("${agent.default}")
    private String defaultAgentLevel;

    /**
     * 获取单条数据
     * @param waybill 运单管理
     * @return 运单管理
     */
    @Override
    public Waybill get(Waybill waybill)
    {
        Waybill dto = super.get(waybill);
        return dto;
    }

    /**
     * 获取单条数据
     * @param id 运单管理id
     * @return 运单管理
     */
    @Override
    public Waybill get(String id)
    {
        Waybill dto = super.get(id);
        return dto;
    }

    @Override
    public List<Waybill> findListByFlight( String flightNo,  Date flightDate){
        return mapper.findListByFlight(flightNo,flightDate);
    }
    /**
     * 查询运单管理列表
     * @param waybill 运单管理
     * @return 运单管理
     */
    @Override
    public List<Waybill> findList(Waybill waybill)
    {
        return super.findList(waybill);
    }

    /**
     * 分页查询运单管理列表
     * @param waybill 运单管理
     * @return 运单管理
     */
    @Override
    public PageInfo<Waybill> findPage(Waybill waybill)
    {
        return super.findPage(waybill);
    }

    /**
     * 保存运单管理
     * @param waybill
     * @return 结果
     */
    @Override
    public boolean save(Waybill waybill)
    {
        waybill.setStatus(0);
        waybill.setSendStatus(0);
        Boolean result = super.save(waybill);
        RTopic waybillQueue = redissonClient.getTopic("waybillQueueTask");
        waybillQueue.publish(waybill);
        return result;
    }

    /**
     * 删除运单管理信息
     * @param waybill
     * @return 结果
     */
    @Override
    public boolean remove(Waybill waybill)
    {
        return super.remove(waybill);
    }

    /**
     * 批量删除运单管理
     * @param ids 需要删除的运单管理ID
     * @return 结果
     */
    @Transactional(readOnly = false)
    @Override
    public int deleteWaybillByIds(String[] ids)
    {
        return mapper.deleteWaybillByIds(ids);
    }

    @Override
    public Waybill get(String waybillNo, String dataSource) {
        return mapper.getByBillno(waybillNo,dataSource);
    }

    @Override
    public Waybill getUnSend(String waybillNo) {
        return mapper.getUnSend(waybillNo);
    }

    @Override
    public void deleteWaybillByBillno(String waybillNo, String dataSource) {
        Waybill waybill =  mapper.getUnSend(waybillNo);
        if(waybill!=null){
            String[] ids={waybill.getId()};
            mapper.deleteWaybillByIds(ids);
        }
    }

    /**
     * 查询差异备案记录
     * @param waybill
     * @return
     */
    @Override
    public resultResponseT<wlpt_diff_producet_queryResponse> queryDiffProducetCommonLevel(Waybill waybill) {
        Long start = System.currentTimeMillis();
        if(waybill.getDiffProductSn() == null){
            return null;
        }
        wlpt_diff_producet_query request = new wlpt_diff_producet_query();
        wlpt_diff_producet_query.data data = request.new data();
        String[] sns= waybill.getDiffProductSn().split(",");
        data.setDifferentiationProductCode(sns);
        data.setWayBill(waybill.getWaybillNo());
        request.setWlpt_diff_producet_query_api(data);
        resultResponseT<wlpt_diff_producet_queryResponse> response = new resultResponseT<>();
        LogEvent event = new LogEvent();
        event.setApiType("获取差异化备案记录");
        try{
            String json = JsonHelper.getInstance().writeValueAsString(request);
            log.info("获取差异化备案记录请求参数: {}", JSON.toJSONString(request));
            String res = HttpUtils.sendPost1(BASE_URL, json);
            log.info("获取差异化备案记录返回结果：{}, 耗时: {}ms", res, System.currentTimeMillis() - start);
            response = JSON.parseObject(res,new TypeReference<resultResponseT<wlpt_diff_producet_queryResponse>>(){});
            event.setSuccess(true);
            publisher.publishEvent(event);
            return response;
        }catch (Exception ex){
            ex.printStackTrace();
            event.setSuccess(false);
            event.setErrorMsg("发生错误，请查看错误日志" + waybill.getWaybillNo());
            publisher.publishEvent(event);
            log.error("获取差异化备案记录查询异常：{}", ex.getMessage());
            return response;
        }
    }

    @Override
    public void syncWlptTestClass() {
        wlpt_agent_score_classification_Response response = queryWlptTestClass(1);
        if (response.getStatus().equals("200")) {
            if (response.getData().getPageCount() > 0) {
                for (wlpt_agent_score_classification_Response.DataDTO.RecordListDTO item : response.getData().getRecordList()) {
                    Agent agent = new Agent();
                    agent.setAgentId(item.getOrgId());
                    agent.setAgentLevel(item.getLevel());
                    agent.setAgentName(item.getOrgName());
                    agent.setType(item.getType());
                    agent.setYear(item.getYear());
                    agent.setQuarter(item.getQuarter());
                    Agent a = agentService.getByAgent(agent);
                    if (a != null) {
                        a.setAgentId(item.getOrgId());
                        a.setAgentLevel(item.getLevel());
                        a.setAgentName(item.getOrgName());
                        a.setType(item.getType());
                        a.setYear(item.getYear());
                        a.setQuarter(item.getQuarter());
                        a.preUpdate();
                        agentMapper.update(a);
                        //agentService.save(a);
                    }else{
                        agent.preInsert();
                        agentMapper.insert(agent);
                        //agentService.save(agent);
                    }
                }
            }
            Integer pageCount = response.getData().getPageCount();
            Integer pageIndex = 1;
            Integer beginPageIndex = response.getData().getBeginPageIndex();
            Integer endPageIndex = response.getData().getEndPageIndex();
            for (Integer i = 2; i <= endPageIndex; i++) {
                response = queryWlptTestClass(i);
                if (response.getStatus().equals("200")) {
                    if (response.getData().getPageCount() > 0) {
                        for (wlpt_agent_score_classification_Response.DataDTO.RecordListDTO item : response.getData().getRecordList()) {
                            Agent agent = new Agent();
                            agent.setAgentId(item.getOrgId());
                            agent.setAgentLevel(item.getLevel());
                            agent.setAgentName(item.getOrgName());
                            agent.setType(item.getType());
                            agent.setYear(item.getYear());
                            agent.setQuarter(item.getQuarter());

                            Agent a = agentService.getByAgent(agent);
                            if (a != null) {
                                a.setAgentId(item.getOrgId());
                                a.setAgentLevel(item.getLevel());
                                a.setAgentName(item.getOrgName());
                                a.setType(item.getType());
                                a.setYear(item.getYear());
                                a.setQuarter(item.getQuarter());
                                a.preUpdate();
                                agentMapper.update(a);
                                //agentService.save(a);
                            }else{
                                agent.preInsert();
                                agentMapper.insert(agent);
                                //agentService.save(agent);
                            }

                        }
                    }
                }
            }
        }
    }


    @Override
    public wlpt_agent_score_classification_Response queryWlptTestClass(Integer pageIndex) {

        Long start = System.currentTimeMillis();
        wlpt_agent_score_classification_query request = new wlpt_agent_score_classification_query();
        request.setWlpt_agent_score_classification(new wlpt_agent_score_classification_query.WlptTestClassDTO());
        request.getWlpt_agent_score_classification().setPage(pageIndex);
        request.getWlpt_agent_score_classification().setSize(100);
        Calendar calendar = Calendar.getInstance();
        Integer year = calendar.get(Calendar.YEAR);
        request.getWlpt_agent_score_classification().setYear(year);
        LogEvent event = new LogEvent();
        event.setApiType("代理人库同步");
        wlpt_agent_score_classification_Response response = new wlpt_agent_score_classification_Response();
        try{
            String json = JsonHelper.getInstance().writeValueAsString(request);
            log.info("代理人库同步接口请求参数: {}", JSON.toJSONString(request));
            String res = HttpUtils.sendPost1(BASE1_URL, json);
            log.info("代理人库同步接口返回结果：{}, 耗时: {}ms", res, System.currentTimeMillis() - start);
            response =(wlpt_agent_score_classification_Response) JSON.parseObject(res,new TypeReference<wlpt_agent_score_classification_Response>(){});
            event.setSuccess(true);
            return response;
        }catch (Exception ex){
            ex.printStackTrace();
            event.setSuccess(false);
            event.setErrorMsg("代理人库同步发生错误，请查看错误日志");
            log.error("代理人库同步异常：{}", ex.getMessage());
            return response;
        }
    }

    /**
     * 特货代码库同步接口
     * @param
     * @return
     */
    @Override
    public wlpt_special_goods_Response queryWlptSpecialGoods(Integer pageIndex) {
        Long start = System.currentTimeMillis();
        wlpt_special_goods_query request = new wlpt_special_goods_query();
        request.setWlpt_special_goods_api(new wlpt_special_goods_query.WlptSpecialGoodsApiDTO());
        request.getWlpt_special_goods_api().setPageNo(pageIndex);
        request.getWlpt_special_goods_api().setPageSize(100);
        LogEvent event = new LogEvent();
        event.setApiType("特货代码库同步");
        wlpt_special_goods_Response response = new wlpt_special_goods_Response();
        try{
            String json = JsonHelper.getInstance().writeValueAsString(request);
            log.info("特货代码库同步接口请求参数: {}", JSON.toJSONString(request));
            String res = HttpUtils.sendPost1(BASE1_URL, json);
            log.info("特货代码库同步接口返回结果：{}, 耗时: {}ms", res, System.currentTimeMillis() - start);
            response =(wlpt_special_goods_Response) JSON.parseObject(res,new TypeReference<wlpt_special_goods_Response>(){});
            event.setSuccess(true);
            return response;
        }catch (Exception ex){
            ex.printStackTrace();
            event.setSuccess(false);
            event.setErrorMsg("特货代码库同步发生错误，请查看错误日志");
            log.error("特货代码库同步异常：{}", ex.getMessage());
            return response;
        }
    }



    @Override
    public void syncWlptSpecialGoods(){
        wlpt_special_goods_Response response = queryWlptSpecialGoods(1);
        if(response.getStatus().equals("200")){
            if(response.getData().getTotalCount()>0){
                for ( wlpt_special_goods_Response.DataDTO.RecordListDTO item :response.getData().getRecordList()){
                    SpecialCode specialCode = new SpecialCode();
                    specialCode.setSpecialCode(item.getSpecialCode());
                    if(specialCodeService.getByCode(specialCode)==null){
                        specialCodeService.save(specialCode);
                    }
                }
            }
            Integer pageCount = response.getData().getPageCount();
            Integer pageIndex = response.getData().getCurrentPage();
            Integer beginPageIndex = response.getData().getBeginPageIndex();
            Integer endPageIndex = response.getData().getEndPageIndex();
            for(Integer i=2;i<=endPageIndex;i++){
                response = queryWlptSpecialGoods(i);
                if(response.getStatus().equals("200")){
                    if (response.getData().getTotalCount() > 0) {
                        for (wlpt_special_goods_Response.DataDTO.RecordListDTO item : response.getData().getRecordList()) {
                            SpecialCode specialCode = new SpecialCode();
                            specialCode.setSpecialCode(item.getSpecialCode());
                            if(specialCodeService.getByCode(specialCode)==null){
                                specialCodeService.save(specialCode);
                            }
                        }
                    }
                }
            }
        }
    }

    /**
     * 查询代理人等级
     * @param waybill
     * @return
     */
    @Override
    public resultResponseT<wlpt_agent_scoreResponse> queryTradeAgentLevel(Waybill waybill) {
        Long start = System.currentTimeMillis();

        wlpt_agent_score request = new wlpt_agent_score();
        wlpt_agent_score.data data = request.new data();
        data.setAgentCode(waybill.getAgentCode());
        data.setOrgName(waybill.getOrganization());
        //data.setWayBill(waybill.getWaybillNo());
        data.setType(waybill.getDataSource().equalsIgnoreCase("ALMS") ? 4 : 1);
        resultResponseT<wlpt_agent_scoreResponse> response = new resultResponseT<>();
        LogEvent event = new LogEvent();
        event.setApiType("查询代理人信用等级");
        try{
            request.setWlpt_agent_score_api(data);
            String json =JsonHelper.getInstance().writeValueAsString(request);
            log.info("运单: {}, 查询代理人信用等级请求参数: {}", waybill.getWaybillNo(), JSON.toJSONString(request));
            String res = HttpUtils.sendPost1(BASE_URL, json);
            log.info("运单: {}, 查询代理人信用等级返回结果：{}, 耗时: {}ms", waybill.getWaybillNo(), res, System.currentTimeMillis() - start);
            response = JSON.parseObject(res, new TypeReference<resultResponseT<wlpt_agent_scoreResponse>>(){});
            event.setSuccess(true);
            publisher.publishEvent(event);
            return response;
        }catch (Exception ex){
            ex.printStackTrace();
            event.setSuccess(false);
            event.setErrorMsg("发生错误，请查看错误日志" + waybill.getWaybillNo());
            publisher.publishEvent(event);
            log.error("运单: {}, 查询代理人信用等级异常：{}", waybill.getWaybillNo(), ex.getMessage());
            return response;
        }

    }


    public Agent queryDBTradeAgentLevel(Waybill waybill) {
        Long start = System.currentTimeMillis();
        Agent agent = new Agent();
        Calendar c = Calendar.getInstance();
        if (waybill.getFlightDate() != null) {
            c.setTime(waybill.getFlightDate());
        }
        agent.setAgentId(waybill.getAgentCode());
        agent.setYear(c.get(Calendar.YEAR));
        int quarter = 1;
        int currentMonth = c.get(Calendar.MONTH) + 1;
        if (currentMonth >= 1 && currentMonth <= 3)
            quarter = 1;
        else if (currentMonth >= 4 && currentMonth <= 6)
            quarter = 2;
        else if (currentMonth >= 7 && currentMonth <= 9)
            quarter = 3;
        else if (currentMonth >= 10 && currentMonth <= 12) {
            quarter = 4;
        }

        if(quarter==1){
            quarter=4;
            Integer year= agent.getYear()-1;
            agent.setYear(year);
            agent.setQuarter(quarter);
        }else {
            agent.setQuarter(quarter - 1);
        }
        agent.setType(waybill.getDataSource().equalsIgnoreCase("ALMS") ? 2 : 1);
        Agent item = agentService.getByAgent(agent);
        return item;

    }


    /**
     * 查询航班等级
     *
     * @param waybill
     * @return
     */
    @Override
    public SyncEmergencyFlight queryEmergencyFlight(Waybill waybill)   {
        Long start = System.currentTimeMillis();
        SyncEmergencyFlight airport = new SyncEmergencyFlight();
        airport.setFlight(waybill.getFlightNo());
        airport.setFlightTime(waybill.getFlightDate());
        airport.setStartupDisable("0");

        log.info("查询航班等级请求参数: {}", JSON.toJSONString(airport));
        List<SyncEmergencyFlight> flights = syncEmergencyFlightService.findList(airport);
        for(SyncEmergencyFlight flight:flights){
            if(flight.getStartupDisable().equals("1")){
                airport.setStartupDisable("1");
                break;
            }
        }
        /*if (flight == null || StringUtils.isBlank(flight.getStartupDisable())) {
            airport.setStartupDisable("0");
        } else {
            airport.setStartupDisable(flight.getStartupDisable());
        }*/
        log.info("查询航班等级结果: {}, 耗时: {}ms", JSON.toJSONString(airport), System.currentTimeMillis() - start);
        return airport;
    }

    @Override
    public boolean Save(syncMethod<transData> info) {
        transBaseInfo item = info.getData().getBaseInfo();
        Waybill waybill=new Waybill();
        waybill.setDataSource(info.getFrom());

        if(item.getFlightDatePlan()!=null && !item.getFlightDatePlan().equals("")){
            waybill.setFlightDate(StringToDate(item.getFlightDatePlan()));
        }
        waybill.setAgentCode(item.getAgentCode() );
        waybill.setBeginFlightDate(item.getFlightDatePlan() );
        waybill.setDestination(item.getDestination() );
            /*String[] sns = item.getDiffProductSn();
            String productctsn = String.join(",",sns);
            waybill.setDiffProductSn(productctsn);*/
        waybill.setDiffProductSn(item.getDiffProductSn());
        waybill.setEndFlightDate(item.getFlightNoPlan());
        waybill.setFlightNo(item.getCarrierCode() + item.getFlightNoPlan());
        waybill.setGoodsName(item.getGoodsName() );
        waybill.setGoodsType(item.getGoodsType() );
        waybill.setOrganization(item.getOrganization() );
        waybill.setGoodsWeight(item.getGoodsWeight() );
        waybill.setGoodsPieces(item.getGoodsPieces() );
        waybill.setOrigin(item.getOrigin() );
        waybill.setShipper(item.getShipper() );
        waybill.setSpecialGoodsCode(item.getSpecialGoodsCode() );
        waybill.setWaybillNo(item.getAwbNo() );
        if(info.getFrom().equalsIgnoreCase("CSIS")){
            Waybill bill= get(waybill.getWaybillNo(),"CFPS");
            if(bill!=null){
                return true;
            }
        }else if(info.getFrom().equalsIgnoreCase("CFPS")){
            Waybill bill= get(waybill.getWaybillNo(),"CSIS");
            if(bill!=null){
                return true;
            }
        }

        deleteWaybillByBillno(waybill.getWaybillNo(),waybill.getDataSource());
        log.info("----------------------------------------------------"+JSON.toJSONString(waybill));
        return save(waybill);
    }
    public GoodsRisk createMQTrade(Waybill waybill, List<WaybillDetail>  details)
    {
        GoodsRisk info = new GoodsRisk();
        tradeGoodsRiskHead head =new tradeGoodsRiskHead();
        head.setWayBillID(waybill.getWaybillNo()); //运单ID
        head.setWayBillNo(waybill.getWaybillNo()); //运单号
        head.setDataSource(waybill.getDataSource()=="1"?"CFPS":"ALMS"); //运单来源
        head.setRiskRating(waybill.getRiskRating()); //综合风险等级（低风险\优先\普通\高风险\严控）
        head.setRiskClassification(waybill.getRiskClassification()); //货物风险等级（普通\低风险\高风险）
        head.setAgentLevel(waybill.getAgentLevel()); //代理人等级
        head.setIsImportantFlights(waybill.getIsImportantFlights()); //重点航班标识

        List<tradeGoodsRiskDetial> detials = new ArrayList<>();
        for (int i=0;i<details.stream().count();i++){
            tradeGoodsRiskDetial detial = new tradeGoodsRiskDetial();
            WaybillDetail item = details.get(i);
            detials.add(detial);
            detial.setTradeName(item.getTradeName()); //货品名
            detial.setTradeNameKey( item.getTradeNameKey()); //货品名关键词
            detial.setTradeType(item.getTradeType()); //货品名所属清单（0-无；1-X光机难辨识清单；2-疑似风险货物清单；3-隐含性危险品清单）
            detial.setTradeRiskClassification(item.getTradeRiskClassification()); //货物风险等级（普通\低风险\高风险）
            detial.setTradeRiskRating( item.getTradeRiskRating());//综合风险等级（低风险\优先\普通\高风险\严控）
        }
        head.setTradeGoodsRiskDetials(detials);
        head.setTradeNames(detials);
        info.setData(head);
        return info;
    }
    @Override
    public gays_flfj_class_push_api createTrade(Waybill waybill, List<WaybillDetail>  details)
    {
        gays_flfj_class_push_api api = new gays_flfj_class_push_api();
        GoodsRiskInfo info = new GoodsRiskInfo();
        api.setGays_flfj_class_push_api(info);
        List<tradeGoodsRiskHeadInfo> heads =new ArrayList<>();
        tradeGoodsRiskHeadInfo head = new tradeGoodsRiskHeadInfo();
        head.setWayBillID(waybill.getWaybillNo()); //运单ID
        head.setWayBillNo(waybill.getWaybillNo()); //运单号
        head.setDataSource("1".equals(waybill.getDataSource()) ? "CFPS" : "ALMS"); //运单来源
        head.setRiskRating(waybill.getRiskRating()); //综合风险等级（低风险\优先\普通\高风险\严控）
        head.setRiskClassification(waybill.getRiskClassification()); //货物风险等级（普通\低风险\高风险）
        head.setAgentLevel(waybill.getAgentLevel()); //代理人等级
        head.setIsImportantFlights(waybill.getIsImportantFlights()); //重点航班标识

        List<tradeGoodsRiskDetial> detials = new ArrayList<>();
        for (int i=0;i<details.stream().count();i++){
            tradeGoodsRiskDetial detial = new tradeGoodsRiskDetial();
            WaybillDetail item = details.get(i);
            detials.add(detial);
            detial.setTradeName(item.getTradeName()); //货品名
            detial.setTradeNameKey( item.getTradeNameKey()); //货品名关键词
            detial.setTradeType(item.getTradeType()); //货品名所属清单（0-无；1-X光机难辨识清单；2-疑似风险货物清单；3-隐含性危险品清单）
            detial.setTradeRiskClassification(item.getTradeRiskClassification()); //货物风险等级（普通\低风险\高风险）
            detial.setTradeRiskRating( item.getTradeRiskRating());//综合风险等级（低风险\优先\普通\高风险\严控）
        }
        //head.setTradeGoodsRiskDetials(detials);
        head.setTradeNames(detials);
        heads.add(head);
        info.setData(heads);
        return api;
    }

    static String appId="airport_cargo_level_check_app";
    static String appKey="bMJwiqf+OW5vYqDIXGgwQg==";
    //static String host="https://10.10.151.116:1443/";
    static String host="http://10.80.36.1:1080/";
    @Override
    public void queryVCsis(Integer day)  {
        Waybill waybill=new Waybill();
        Date date=new Date();//取时间
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.add(Calendar.DATE,day);
        List<VCsisBusinessAsd> asdList= queryVCsisBusinessAsd(calendar);
        LogEvent event = new LogEvent();
        event.setApiType("Csis开箱数据查询");
        for(VCsisBusinessAsd asd:asdList){
            VCsisBusinessAsd asdItem= vCsisBusinessAsdService.get(asd);
            event.setSuccess(true);
            publisher.publishEvent(event);
            if(asdItem==null){
                asd.setStatus(0);
                vCsisBusinessAsdService.save(asd);
                List<VCsisBusinessRecord> recordList= queryVCsisBusinessRecord(asd.getAwbno());
                for(VCsisBusinessRecord record:recordList){
                    vCsisBusinessRecordService.save(record);
                }
                List<VCsisBusinessUnpacking> unpackingList= queryVCsisBusinessUnpacking(asd.getAwbno());
                for(VCsisBusinessUnpacking unpacking:unpackingList){
                    vCsisBusinessUnpackingService.save(unpacking);
                }
                List<VCsisBusinessRelease> releaseList= queryVCsisBusinessRelease(asd.getAwbno());
                for(VCsisBusinessRelease release:releaseList){
                    vCsisBusinessReleaseService.save(release);
                }
            }
        }
    }

    //查询国内运单基础数据
    @Override
    public List<VCsisBusinessAsd> queryVCsisBusinessAsd(Calendar calendar) throws NullPointerException {
       /* String res = HttpUtils.sendGet1(host+"bigdata/dm/huawei/v1/awbInfo/query","resLength=200",appId,appKey);
        //String res ="{\"retCode\":\"0\",\"retJSON\":{\"result\":[{\"awbno\":\"880-04677514\",\"cargodesc\":\"文件，服饰，充电模块[P]纸箱\",\"flightno\":\"HU7028\",\"flightdate\":\"2021-10-01 00:00:00\"},{\"awbno\":\"112-41063875\",\"cargodesc\":\"平板电脑，笔记本电脑，智能手表，智能手环，蓝牙耳机，自拍杆，触控笔，打印机，无人机，手机（含锂电池）\",\"flightno\":\"MU5244\",\"flightdate\":\"2021-10-26 00:00:00\"},{\"awbno\":\"000-68734750\",\"cargodesc\":\"经济邮件（经邮）\",\"flightno\":\"MF8390\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"018-18474820\",\"cargodesc\":\"摄像头取像模块\",\"flightno\":\"HO1202\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"018-18474831\",\"cargodesc\":\"摄像头取像模块\",\"flightno\":\"HO1202\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"018-18474842\",\"cargodesc\":\"摄像头取像模块\",\"flightno\":\"HO1202\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"018-18474853\",\"cargodesc\":\"集成电路\",\"flightno\":\"HO1202\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"018-18474864\",\"cargodesc\":\"白酒 （验酒器含碱性电池）\",\"flightno\":\"HO1202\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"018-18474875\",\"cargodesc\":\"LED模组\",\"flightno\":\"HO1202\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"018-18474886\",\"cargodesc\":\"五金件，塑料件，线路板，支架，纸张。主板，芯片。二极管，模具，电阻。电感。电路板。布辦。灯珠。灯板。连接器。钢网，液晶显示屏，上衣，裤子。反革，布料\",\"flightno\":\"HO1202\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"018-18477152\",\"cargodesc\":\"电路板、上衣、裤子、鞋子、皮包、显卡、数据、轴承、活塞、硬盘等详见航空货物明细单\",\"flightno\":\"HO1156\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"018-18477756\",\"cargodesc\":\"线路板，电源适配器\",\"flightno\":\"HO1112\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"018-18477771\",\"cargodesc\":\"主板，服装，鞋材，二极管，芯片，摄像头，内存条，连接器\",\"flightno\":\"HO1112\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"018-18477782\",\"cargodesc\":\"保护膜,\",\"flightno\":\"HO1112\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"018-18477793\",\"cargodesc\":\"主板，服装，鞋材，二极管，芯片，摄像头，内存条，连接器\",\"flightno\":\"HO1112\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"018-18477804\",\"cargodesc\":\"服装\",\"flightno\":\"HO1156\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"018-18477815\",\"cargodesc\":\"服装\",\"flightno\":\"HO1156\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"018-18477826\",\"cargodesc\":\"主板，服装，鞋材，二极管，芯片，摄像头，内存条，连接器\",\"flightno\":\"HO1156\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"018-18477830\",\"cargodesc\":\"箱包,铜模型,\",\"flightno\":\"HO1156\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"018-18477841\",\"cargodesc\":\"主板，服装，鞋材，二极管，芯片，摄像头，内存条，连接器 \",\"flightno\":\"HO1156\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"018-18477852\",\"cargodesc\":\"主板，服装，鞋材，二极管，芯片，摄像头，内存条，连接器\",\"flightno\":\"HO1156\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"018-18477863\",\"cargodesc\":\"电子连接器（内含氧化银电池SR626SW，依据特殊规定A123,不受规则限制。），电路板，模块，内存。\",\"flightno\":\"HO1156\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"018-18477874\",\"cargodesc\":\"主板，服装，鞋材，二极管，芯片，摄像头，内存条，连接器\",\"flightno\":\"HO1156\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"018-18484071\",\"cargodesc\":\"集成电路\",\"flightno\":\"HO1202\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"018-18484082\",\"cargodesc\":\"电路板\",\"flightno\":\"HO1202\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"018-18484093\",\"cargodesc\":\"食材 餐料 包装盒 \",\"flightno\":\"HO1202\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"089-19162323\",\"cargodesc\":\"车载模组\",\"flightno\":\"9C8882\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"089-19162334\",\"cargodesc\":\"五金件,塑料件,线路板,支架,机械表,布辦,灯珠,灯板,连接器,钢网,液晶显示屏,上衣,裤子,皮革,布料\",\"flightno\":\"9C8950\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"089-19162345\",\"cargodesc\":\"LED灯\",\"flightno\":\"9C8950\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"089-19162356\",\"cargodesc\":\"变频器\",\"flightno\":\"9C8950\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-38814333\",\"cargodesc\":\"背光源\",\"flightno\":\"MU6670\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41062965\",\"cargodesc\":\"五金件，线路板，芯片，铁片，塑料件 \",\"flightno\":\"MU5348\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41062976\",\"cargodesc\":\"五金件，上衣，裤子，标签，线路板，\",\"flightno\":\"MU5346\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41062980\",\"cargodesc\":\"线路板，五金件，支架，主板，芯片 \",\"flightno\":\"FM9334\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41062991\",\"cargodesc\":\"硅胶件,探针，\",\"flightno\":\"MU5244\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41066152\",\"cargodesc\":\"服装、鞋材\",\"flightno\":\"MU6670\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41066163\",\"cargodesc\":\"塑胶，线路板，开关，水果（芒果，葡萄，莲雾） ，玩具，手表（氧化银电池SR612）\",\"flightno\":\"MU2558\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41068075\",\"cargodesc\":\"电子连接器  电路板\",\"flightno\":\"MU5758\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41068086\",\"cargodesc\":\"FPC板 拉链 LED灯条 鞋子 塑胶件 海报 螺丝 线路板 服装 显示器 手表（氧化银电池SR621SW） 广告画 布料 纸巾 铁制模块 线材\",\"flightno\":\"MU2938\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41068090\",\"cargodesc\":\"拉链 LED灯条 鞋子 塑胶件 海报 螺丝 线路板 服装 显示器 手表（氧化银电池SR621SW） 广告画 布料 纸巾 铁制模块 线材\",\"flightno\":\"MU6670\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41068101\",\"cargodesc\":\"电线\",\"flightno\":\"MU5360\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41068112\",\"cargodesc\":\"摄像头取像模块\",\"flightno\":\"MU5358\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41068123\",\"cargodesc\":\"拉链 LED灯条 鞋子 塑胶件 海报 螺丝 线路板 服装 显示器 手表（氧化银电池SR621SW） 广告画 布料 纸巾 铁制模块 线材\",\"flightno\":\"MU6670\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41070363\",\"cargodesc\":\"集成电路\",\"flightno\":\"MU5352\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41070945\",\"cargodesc\":\"服装\",\"flightno\":\"MU6670\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41071505\",\"cargodesc\":\"五金件，摩托车配件 \",\"flightno\":\"MU5354\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41071516\",\"cargodesc\":\"五金片,塑料片,线路板,纸张,灯壳,芯片,上衣,裤子,鞋子,灯壳,陶瓷 \",\"flightno\":\"MU2938\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41071520\",\"cargodesc\":\"五金件，线路板，塑料件，芯片 \",\"flightno\":\"MU5358\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41071531\",\"cargodesc\":\"五金件，塑料件，线路板。支架，纸张，主板，芯片，二极管，模具，电阻，电感，灯珠，灯板，连接器， \",\"flightno\":\"MU5360\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41071542\",\"cargodesc\":\"线路板,贴纸,集成电路,线缆,连接器,接插件,塑胶件,五金模具 \",\"flightno\":\"MU2558\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41077282\",\"cargodesc\":\"珠宝证书\",\"flightno\":\"MU5354\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41077293\",\"cargodesc\":\"钻石 证书\",\"flightno\":\"MU5358\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41077304\",\"cargodesc\":\"集成电路 \",\"flightno\":\"MU5358\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41078811\",\"cargodesc\":\"线路板,二极管,端子，铝件,保护膜,膜片,电子模块,塑胶件，硅胶件,五金支架，铁片，螺丝，五金壳，塑胶壳, \",\"flightno\":\"MU2326\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41078822\",\"cargodesc\":\"马达 轴承 \",\"flightno\":\"MU5348\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41078833\",\"cargodesc\":\"巧克力 \",\"flightno\":\"MU5244\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41078844\",\"cargodesc\":\"陶瓷工具，刀杆\",\"flightno\":\"MU5350\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41078855\",\"cargodesc\":\"阻压器\",\"flightno\":\"MU5354\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41078866\",\"cargodesc\":\"衣服 鞋子 包\",\"flightno\":\"MU5360\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41078870\",\"cargodesc\":\"检测仪 \",\"flightno\":\"MU5358\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41078881\",\"cargodesc\":\"连接器 \",\"flightno\":\"MU5358\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41078892\",\"cargodesc\":\"集成电路 \",\"flightno\":\"MU5360\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41078903\",\"cargodesc\":\"服装\",\"flightno\":\"MU5360\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41078914\",\"cargodesc\":\"钻头 \",\"flightno\":\"MU5360\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41078925\",\"cargodesc\":\"充电电机\",\"flightno\":\"MU2878\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41078936\",\"cargodesc\":\"橡胶条\",\"flightno\":\"MU2558\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41078940\",\"cargodesc\":\"金属器件 \",\"flightno\":\"MU5360\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41078951\",\"cargodesc\":\"服装\",\"flightno\":\"MU6670\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41078962\",\"cargodesc\":\"衣服辅料\",\"flightno\":\"MU2878\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41083523\",\"cargodesc\":\"酒\",\"flightno\":\"MU5244\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41083556\",\"cargodesc\":\"电路板\",\"flightno\":\"MU2326\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41083560\",\"cargodesc\":\"线路板\",\"flightno\":\"MU5348\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41083593\",\"cargodesc\":\"五金架子\",\"flightno\":\"MU5346\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41083604\",\"cargodesc\":\"铝条 五金面壳 塑胶件\",\"flightno\":\"MU5244\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41083615\",\"cargodesc\":\"手机配件 塑胶壳 连接器 摄像头 保护膜 五金配件 螺丝\",\"flightno\":\"MU5354\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41083626\",\"cargodesc\":\"牙模\",\"flightno\":\"FM9334\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41083630\",\"cargodesc\":\"LED灯\",\"flightno\":\"MU5350\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41083641\",\"cargodesc\":\"服装 线路板  摄像头 塑胶 玩具 手表\",\"flightno\":\"MU5354\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41083652\",\"cargodesc\":\"海鲜 鱼 虾 蟹 元贝 花甲\",\"flightno\":\"MU5354\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41083663\",\"cargodesc\":\"黄金珠宝\",\"flightno\":\"MU5360\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41083674\",\"cargodesc\":\"频谱仪\",\"flightno\":\"MU5354\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41083685\",\"cargodesc\":\"电脑配件\",\"flightno\":\"MU5360\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41083696\",\"cargodesc\":\"玻璃\",\"flightno\":\"MU5360\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41083700\",\"cargodesc\":\"服装\",\"flightno\":\"MU5360\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41083711\",\"cargodesc\":\"单板(内含氧化银纽扣电池364SR621SW）\",\"flightno\":\"MU5360\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41083722\",\"cargodesc\":\"手机保护屏\",\"flightno\":\"MU6670\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41083733\",\"cargodesc\":\"镀银钛纪念章\",\"flightno\":\"MU5360\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41083744\",\"cargodesc\":\"电源 连接器\",\"flightno\":\"MU5360\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41088014\",\"cargodesc\":\"手机摄像头支架\",\"flightno\":\"MU5358\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41088051\",\"cargodesc\":\"集成电路\",\"flightno\":\"MU5358\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"112-41088095\",\"cargodesc\":\"主板，服装，鞋材，二极管，芯片，摄像头，内存条，连接器（内含氧化银电池SR626SW，依据特殊规定A123,不受规则限制。）\",\"flightno\":\"MU2878\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"666-01710461\",\"cargodesc\":\"电路板、上衣、裤子、鞋子、皮包、显卡、数据、轴承、活塞、硬盘等详见航空货物明细单\",\"flightno\":\"FU6746\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"731-71828363\",\"cargodesc\":\"主板 服装 鞋材 芯片 内存条 连接器 纽扣 铝材 电源线 显卡 声卡 购物袋 交换机 眼镜架 机顶盒（内有干电池，依据特殊规定A123，不受限制）\",\"flightno\":\"MF8390\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"731-71828374\",\"cargodesc\":\"集成电路\",\"flightno\":\"MF8318\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"731-71828746\",\"cargodesc\":\"服装 鞋材 芯片 内存条 连接器 纽扣 铝材 显卡 声卡 手套 手表（含氧化银电池）\",\"flightno\":\"MF8384\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"731-71829435\",\"cargodesc\":\"海鲜\",\"flightno\":\"MF8318\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"731-71829446\",\"cargodesc\":\"IC集成电路\",\"flightno\":\"MF8318\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"731-71829450\",\"cargodesc\":\"海鲜\",\"flightno\":\"MF8318\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"731-71829645\",\"cargodesc\":\"服装\",\"flightno\":\"MF8384\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"731-71829741\",\"cargodesc\":\"服装\",\"flightno\":\"MF8384\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"731-71829752\",\"cargodesc\":\"服装\",\"flightno\":\"MF8384\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"731-71829763\",\"cargodesc\":\"服装\",\"flightno\":\"MF8384\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"731-71830006\",\"cargodesc\":\"主板，服装，鞋材，二极管，芯片，摄像头，内存条，连接器\",\"flightno\":\"MF8318\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"826-11489155\",\"cargodesc\":\"电路板，电子连接器，组件，模块\",\"flightno\":\"GS7926\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"826-11489542\",\"cargodesc\":\"电阻  电熔 汽车摇控器  天线\",\"flightno\":\"GS7926\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"826-11489553\",\"cargodesc\":\"拉链 LED灯条 鞋子 塑胶件 海报 螺丝 线路板 服装 显示器 手表（氧化银电池SR621SW） 广告画 布料 纸巾 铁制模块 线材 五金配件\",\"flightno\":\"GS7926\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"826-11489612\",\"cargodesc\":\"五金自支架\",\"flightno\":\"GS7926\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"826-11489623\",\"cargodesc\":\"散热器,线路板,鞋子,装饰品,皮具,塑胶件,毛料,车灯,二极管,双面胶,眼镜,炒锅,钢网\",\"flightno\":\"GS7926\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"826-11489855\",\"cargodesc\":\"电路板、上衣、裤子、鞋子、皮包、显卡、数据、轴承、活塞、硬盘等详见航空货物明细单\",\"flightno\":\"GS7926\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"847-03639591\",\"cargodesc\":\"电路板、上衣、裤子、鞋子、皮包、显卡、数据、轴承、活塞、硬盘等详见航空货物明细单\",\"flightno\":\"PN6312\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"847-03810236\",\"cargodesc\":\"服装\",\"flightno\":\"PN6230\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"847-03810240\",\"cargodesc\":\"内存 服装\",\"flightno\":\"PN6312\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"847-03810251\",\"cargodesc\":\"服装\",\"flightno\":\"PN6230\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"847-03810262\",\"cargodesc\":\"显示器\",\"flightno\":\"PN6312\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"847-03810295\",\"cargodesc\":\"PCB板\",\"flightno\":\"PN6312\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"847-03810306\",\"cargodesc\":\"服装\",\"flightno\":\"PN6312\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"859-11739976\",\"cargodesc\":\"印版\",\"flightno\":\"8L9980\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"859-11739980\",\"cargodesc\":\"拉链 LED灯条 鞋子 塑胶件 海报 螺丝 线路板 服装 显示器 手表（氧化银电池SR621SW） 广告画 布料 纸巾 铁制模块 线材 太阳镜，手链，美甲工具，玩 具，手机光，表带，积木，贴纸\",\"flightno\":\"8L9980\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"859-11739991\",\"cargodesc\":\"线路板连接器集成电路螺丝铁片塑胶件五金模具\",\"flightno\":\"8L9980\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"859-11740002\",\"cargodesc\":\"塑料瓶橡根服装扣子布料\",\"flightno\":\"8L9980\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"866-07559742\",\"cargodesc\":\"LED灯条\",\"flightno\":\"BK2746\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"866-07559753\",\"cargodesc\":\"端子,显示屏,线路板,塑胶件,线束,模具,衣服,模块,灯条,车膜,电源线,火板,连接器,支架,铝件,铜线,垫片,钢网\",\"flightno\":\"BK3130\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"866-07559764\",\"cargodesc\":\"塑胶件,PCB板,车膜.,铁件,社保卡,灯具,模具,线材,路板 \",\"flightno\":\"BK2746\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"866-07559775\",\"cargodesc\":\"汽车收放机  线路板  数据线 塑胶壳  铁制模块 \",\"flightno\":\"BK2746\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"867-10186105\",\"cargodesc\":\"服装\",\"flightno\":\"LT4346\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"876-04662674\",\"cargodesc\":\"主板 服装 鞋材 二极管 芯片 内存条 连接器 钮扣 铝材\",\"flightno\":\"3U8704\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"876-04662685\",\"cargodesc\":\"主板 服装 鞋材 二极管 芯片 内存条 连接器 钮扣 铝材\",\"flightno\":\"3U8704\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"876-04662696\",\"cargodesc\":\"主板 服装 鞋材 二极管 芯片 内存条 连接器 钮扣 铝材 \",\"flightno\":\"3U8704\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"876-04662700\",\"cargodesc\":\"主板 服装 鞋材 二极管 芯片 内存条 连接器 钮扣 铝材\",\"flightno\":\"3U8706\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"876-04986844\",\"cargodesc\":\"绝缘脉冲测试仪分线盒\",\"flightno\":\"3U8784\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"876-04986855\",\"cargodesc\":\"车载,电路板,复合板,摄像头镜片,塑胶壳\",\"flightno\":\"3U8784\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"876-04986866\",\"cargodesc\":\"玻璃屏幕\",\"flightno\":\"3U8706\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"876-04986870\",\"cargodesc\":\"纸张,单板,玻璃,驱动电源,眼镜,上衣,裤子,塑胶壳,连接器\",\"flightno\":\"3U8704\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"876-04986881\",\"cargodesc\":\"服装  布条\",\"flightno\":\"3U8784\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"876-04986892\",\"cargodesc\":\"线路板,纸张,鞋子,木板,卡板,载带,晶体管,炒锅,上衣,裤子,连接器,电路板\",\"flightno\":\"3U8706\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"876-04986903\",\"cargodesc\":\"塑胶壳,电路板,连接器,铁件\",\"flightno\":\"3U8706\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"876-04986914\",\"cargodesc\":\"线路板,塑胶制品,五金件、支架、纸张、铝材、手板\",\"flightno\":\"3U8786\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"876-05010961\",\"cargodesc\":\"服装\",\"flightno\":\"3U8786\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"876-05010972\",\"cargodesc\":\"集成电路\",\"flightno\":\"3U8786\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"876-05010983\",\"cargodesc\":\"集成电路 \",\"flightno\":\"3U8786\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"876-05911345\",\"cargodesc\":\"电路板、上衣、裤子、鞋子、皮包、显卡、数据、轴承、活塞、硬盘等详见航空货物明细单\",\"flightno\":\"3U8706\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"876-05911356\",\"cargodesc\":\"电路板、上衣、裤子、鞋子、皮包、显卡、数据、轴承、活塞、硬盘等详见航空货物明细单\",\"flightno\":\"3U8706\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"876-05911360\",\"cargodesc\":\"电路板、上衣、裤子、鞋子、皮包、显卡、数据、轴承、活塞、硬盘等详见航空货物明细单\",\"flightno\":\"3U8786\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04634394\",\"cargodesc\":\"电路板、上衣、裤子、鞋子、皮包、显卡、数据、轴承、活塞、硬盘等详见航空货物明细单\",\"flightno\":\"HU7357\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04634405\",\"cargodesc\":\"电路板、上衣、裤子、鞋子、皮包、显卡、数据、轴承、活塞、硬盘等详见航空货物明细单\",\"flightno\":\"HU7557\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04641394\",\"cargodesc\":\"电路板、上衣、裤子、鞋子、皮包、显卡、数据、轴承、活塞、硬盘等详见航空货物明细单\",\"flightno\":\"HU7706\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04641405\",\"cargodesc\":\"电路板、上衣、裤子、鞋子、皮包、显卡、数据、轴承、活塞、硬盘等详见航空货物明细单\",\"flightno\":\"HU6120\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04641416\",\"cargodesc\":\"电路板、上衣、裤子、鞋子、皮包、显卡、数据、轴承、活塞、硬盘等详见航空货物明细单\",\"flightno\":\"HU7397\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04641420\",\"cargodesc\":\"电路板、上衣、裤子、鞋子、皮包、显卡、数据、轴承、活塞、硬盘等详见航空货物明细单\",\"flightno\":\"HU7750\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04641431\",\"cargodesc\":\"电路板、上衣、裤子、鞋子、皮包、显卡、数据、轴承、活塞、硬盘等详见航空货物明细单\",\"flightno\":\"HU7022\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04657774\",\"cargodesc\":\"白酒 （验酒器含碱性电池）\",\"flightno\":\"HU7706\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04657785\",\"cargodesc\":\"塑胶开关\",\"flightno\":\"HU7706\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04666911\",\"cargodesc\":\"海鲜（鱼虾蟹蚌）\",\"flightno\":\"HU7761\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04666922\",\"cargodesc\":\"线路板,五金片,织带,包包,开关,纽扣,线束,温控器,上衣裤子,二极管,双面胶,手板模型\",\"flightno\":\"HU7761\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04666933\",\"cargodesc\":\"贵宾犬1只（狗18KG，笼6KG）\",\"flightno\":\"HU7706\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04666944\",\"cargodesc\":\"楼房模具\",\"flightno\":\"HU6120\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04666955\",\"cargodesc\":\"线路板,光纤,电路板,铝件,电阻,灯条,电缆,手表,灯具,主板,二极管,传感器,滤波器\",\"flightno\":\"HU7706\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04666966\",\"cargodesc\":\"接插头\",\"flightno\":\"HU7397\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04666970\",\"cargodesc\":\"电路板, U盘\",\"flightno\":\"HU6120\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04666981\",\"cargodesc\":\"适配器，数码管，拉链\",\"flightno\":\"HU7750\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04666992\",\"cargodesc\":\"铁片,五金件,电子管,电路板,支架\",\"flightno\":\"HU7750\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04667003\",\"cargodesc\":\"服装\",\"flightno\":\"HU7397\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04671262\",\"cargodesc\":\"手机用取像模块\",\"flightno\":\"HU7733\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04671273\",\"cargodesc\":\"手机用取像模块\",\"flightno\":\"HU7733\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04671284\",\"cargodesc\":\"服装\",\"flightno\":\"HU7393\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04672695\",\"cargodesc\":\"触控面板显示模组传感器\",\"flightno\":\"HU7706\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04672721\",\"cargodesc\":\"电路板\",\"flightno\":\"HU7706\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04675576\",\"cargodesc\":\"烟盒\",\"flightno\":\"HU7706\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04676070\",\"cargodesc\":\"连接器\",\"flightno\":\"HU7257\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04676081\",\"cargodesc\":\"艾普拉唑肠溶片\",\"flightno\":\"HU7255\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04676276\",\"cargodesc\":\"显示器\",\"flightno\":\"HU7733\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04676280\",\"cargodesc\":\"服装 鞋帽  牛肉丸 包装盒 五金模组 线路板 塑胶件 LED灯具 线材 电子元件 护肤品 机壳\",\"flightno\":\"HU7733\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04676291\",\"cargodesc\":\"纸张,手机壳,铝件,显示屏\",\"flightno\":\"HU7733\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04676302\",\"cargodesc\":\"五金件,线路板,塑胶件,铁件,布料,纸张,电容电阻,线束,铜巴,铝材\",\"flightno\":\"HU7255\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04676313\",\"cargodesc\":\"匹配加热器，充电总成\",\"flightno\":\"HU7727\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04676324\",\"cargodesc\":\"虾仁干 鱼干 包装盒\",\"flightno\":\"HU7393\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04676335\",\"cargodesc\":\"服装鞋\",\"flightno\":\"HU7727\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04676346\",\"cargodesc\":\"线路板,铁片,螺丝,五金件,支架,塑胶件\",\"flightno\":\"HU7727\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04676350\",\"cargodesc\":\"服装\",\"flightno\":\"HU7357\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04676361\",\"cargodesc\":\"服装\",\"flightno\":\"HU7557\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04676372\",\"cargodesc\":\"IC集成电路线路板\",\"flightno\":\"HU7557\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04676383\",\"cargodesc\":\"IC集成电路线路板\",\"flightno\":\"HU7557\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04676394\",\"cargodesc\":\"服装\",\"flightno\":\"HU7557\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04676405\",\"cargodesc\":\"线路板 PCB板\",\"flightno\":\"HU7557\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04676416\",\"cargodesc\":\"集成电路\",\"flightno\":\"HU7557\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"880-04676420\",\"cargodesc\":\"端子,塑胶件,彩盒,显示屏,泡棉,铜管,包包,铁片,线束\",\"flightno\":\"HU7557\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"891-05211835\",\"cargodesc\":\"内存 固态硬盘 CPU处理器\",\"flightno\":\"GJ8738\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"891-05211846\",\"cargodesc\":\"线路板,五金片,织带,包包,温控器,手板温控器,上衣裤子,二极管,\",\"flightno\":\"GJ8738\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"891-05211850\",\"cargodesc\":\"服装\",\"flightno\":\"GJ8738\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"891-05211861\",\"cargodesc\":\"服装\",\"flightno\":\"GJ8738\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"893-03397310\",\"cargodesc\":\"电路板、上衣、裤子、鞋子、皮包、显卡、数据、轴承、活塞、硬盘等详见航空货物明细单\",\"flightno\":\"DZ6225\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"893-03397321\",\"cargodesc\":\"电路板、上衣、裤子、鞋子、皮包、显卡、数据、轴承、活塞、硬盘等详见航空货物明细单\",\"flightno\":\"DZ6203\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"893-03412161\",\"cargodesc\":\"服装 \",\"flightno\":\"DZ6203\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"893-03412172\",\"cargodesc\":\"大支架\",\"flightno\":\"DZ6203\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"893-03412183\",\"cargodesc\":\"文件 纸张 \",\"flightno\":\"DZ6225\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"893-03412205\",\"cargodesc\":\"拉链 LED灯条 鞋子 塑胶件 海报 螺丝 线路板 服装 显示器 手表（氧化银电池SR621SW） 广告画 布料 纸巾 \",\"flightno\":\"DZ6225\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"893-03412216\",\"cargodesc\":\"服装 \",\"flightno\":\"DZ6225\",\"flightdate\":\"2021-10-27 00:00:00\"},{\"awbno\":\"000-66790080\",\"cargodesc\":\"经济邮件（经邮）\",\"flightno\":\"MF8390\",\"flightdate\":\"2021-10-28 00:00:00\"},{\"awbno\":\"000-67060302\",\"cargodesc\":\"经济邮件（经邮）\",\"flightno\":\"HU7773\",\"flightdate\":\"2021-10-28 00:00:00\"},{\"awbno\":\"000-67231102\",\"cargodesc\":\"特快邮件（标邮）\",\"flightno\":\"3U8702\",\"flightdate\":\"2021-10-28 00:00:00\"}]}}";
        log.info("test debug queryVCsisBusinessAsd:"+host+"bigdata/dm/huawei/v1/awbInfo/query  response:"+res);
        csis_riskrating_riskmarking<csis_riskrating_riskmarking.awbInfo_query> data = new csis_riskrating_riskmarking<>();

        data =(csis_riskrating_riskmarking<csis_riskrating_riskmarking.awbInfo_query> ) JSON.parseObject(res,new TypeReference<csis_riskrating_riskmarking<csis_riskrating_riskmarking.awbInfo_query> >(){});

        List<csis_riskrating_riskmarking.awbInfo_query.ResultDTO> query = data.getRetJSON().getResult();

        List<VCsisBusinessAsd> asdList =new ArrayList<>();
        if(query!=null && query.stream().count()>0){
            for(csis_riskrating_riskmarking.awbInfo_query.ResultDTO item:query){
                VCsisBusinessAsd asd = new VCsisBusinessAsd();
                asd.setCargodesc(item.getCargoDesc());
                asd.setAwbno(item.getAwbNo());
                asd.setFlightno(item.getFlightNo());
                asd.setFlightdate(StringToDateTime(item.getFlightDate()));
                asdList.add(asd);
            }
        }*/

        Waybill waybill = new Waybill();
        waybill.setFlightDate(calendar.getTime());
        List<Waybill> billList =   findList(waybill);
        List<VCsisBusinessAsd> asdList =new ArrayList<>();

        if(billList!=null && billList.stream().count()>0){
            for(Waybill item:billList){
                VCsisBusinessAsd asd = new VCsisBusinessAsd();
                asd.setCargodesc(item.getGoodsName());
                asd.setAwbno(item.getWaybillNo());
                asd.setFlightno(item.getFlightNo());
                asd.setFlightdate(item.getFlightDate());
                asdList.add(asd);
            }
        }
        return asdList;
    }
    @Override
    public List<VCsisBusinessRelease> queryVCsisBusinessRelease(String waybillno) {
        String res = HttpUtils.sendGet1(host+"bigdata/dm/huawei/v1/awbReleaseInfo/query","awbNo="+waybillno,appId,appKey);
        log.info("test debug queryVCsisBusinessRelease:"+host+"bigdata/dm/huawei/v1/awbReleaseInfo/query?awbNo="+waybillno+" response:"+res);
        csis_riskrating_riskmarking<csis_riskrating_riskmarking.awbReleaseInfo_query> data = new csis_riskrating_riskmarking<>();
        data =(csis_riskrating_riskmarking<csis_riskrating_riskmarking.awbReleaseInfo_query> ) JSON.parseObject(res,new TypeReference<csis_riskrating_riskmarking<csis_riskrating_riskmarking.awbReleaseInfo_query> >(){});

        List<csis_riskrating_riskmarking.awbReleaseInfo_query.ResultDTO> query = data.getRetJSON().getResult();
        List<VCsisBusinessRelease> releases =new ArrayList<>();
        if(query!=null && query.stream().count()>0){
            for(csis_riskrating_riskmarking.awbReleaseInfo_query.ResultDTO item : query) {
                VCsisBusinessRelease release = new VCsisBusinessRelease();
                release.setMwbno(waybillno);
                release.setReleaseoptr(item.getReleaseOptr());
                if (item.getReleaseTime() != null && item.getReleaseTime() != "") {
                    release.setReleasetime(StringToDateTime(item.getReleaseTime()));
                }
                releases.add(release);
            }
        }
        return releases;
    }
    //查询国内安检数据
    @Override
    public List<VCsisBusinessRecord> queryVCsisBusinessRecord(String waybillno) throws NullPointerException {
        String res = HttpUtils.sendGet1(host+"bigdata/dm/huawei/v1/awbrecordInfo/query","awbNo="+waybillno,appId,appKey);
        log.info("test debug queryVCsisBusinessRecord:"+host+"bigdata/dm/huawei/v1/awbrecordInfo/query?awbNo="+waybillno+" response:"+res);
        csis_riskrating_riskmarking<csis_riskrating_riskmarking.awbrecordInfo_query> data = new csis_riskrating_riskmarking<>();
        data =(csis_riskrating_riskmarking<csis_riskrating_riskmarking.awbrecordInfo_query> ) JSON.parseObject(res,new TypeReference<csis_riskrating_riskmarking<csis_riskrating_riskmarking.awbrecordInfo_query> >(){});
        //data= JsonHelper.getInstance().readValue(res,data.getClass());
        List<csis_riskrating_riskmarking.awbrecordInfo_query.ResultDTO> query = data.getRetJSON().getResult();
        List<VCsisBusinessRecord> records =new ArrayList<>();
        if(query!=null && query.stream().count()>0){
            for(csis_riskrating_riskmarking.awbrecordInfo_query.ResultDTO item : query) {
                VCsisBusinessRecord record = new VCsisBusinessRecord();
                record.setCargonumber(item.getCargoNumber());
                record.setAwbno(waybillno);//  item.getAwbNo());
                record.setCheckpoint(item.getCheckPoint());
                if (item.getStartTime() != null && item.getStartTime() != "") {
                    record.setStarttime(StringToDateTime(item.getStartTime()));
                }
                if (item.getEndTime() != null && item.getEndTime() != "") {
                    record.setEndtime(StringToDateTime(item.getEndTime()));
                }
                if (item.getSecurityPcs() != null && item.getSecurityPcs() != "") {
                    record.setSecuritypcs(Convert.toLong(item.getSecurityPcs()));
                }
                records.add(record);
            }
        }
        return records;
    }
    //查询国内开箱数据
    @Override
    public List<VCsisBusinessUnpacking> queryVCsisBusinessUnpacking(String waybillno) throws NullPointerException {
        String res = HttpUtils.sendGet1(host + "bigdata/dm/huawei/v1/awbunpackingInfo/query", "awbNo=" + waybillno, appId, appKey);
        log.info("test debug queryVCsisBusinessUnpacking:" + host + "bigdata/dm/huawei/v1/awbunpackingInfo/query?awbNo=" + waybillno + " response:" + res);
        csis_riskrating_riskmarking<csis_riskrating_riskmarking.awbunpackingInfo_query> data = new csis_riskrating_riskmarking<>();
        data = (csis_riskrating_riskmarking<csis_riskrating_riskmarking.awbunpackingInfo_query>) JSON.parseObject(res, new TypeReference<csis_riskrating_riskmarking<csis_riskrating_riskmarking.awbunpackingInfo_query>>() {
        });
        List<csis_riskrating_riskmarking.awbunpackingInfo_query.ResultDTO> query = data.getRetJSON().getResult();
        List<VCsisBusinessUnpacking> unpackings = new ArrayList<>();
        if (query != null && query.stream().count() > 0) {
            for (csis_riskrating_riskmarking.awbunpackingInfo_query.ResultDTO item : query) {
                VCsisBusinessUnpacking unpacking = new VCsisBusinessUnpacking();
                unpacking.setAwbbatch(item.getAwbBatch());
                unpacking.setMwbno(waybillno);//item.getAwbNo());

                if (item.getCreateTime() != null && item.getCreateTime() != "") {
                    unpacking.setCreateTime(StringToDateTime(item.getCreateTime()));
                }

                unpacking.setCargoname(item.getCargoName());
                if (item.getCount() != null && item.getCount() != "") {
                    unpacking.setCount(Convert.toLong(item.getCount()));
                }
                unpacking.setUnit(item.getUnit());
                unpacking.setResult(item.getResult());
                unpackings.add(unpacking);
            }
        }
        return unpackings;
    }




    private MessageProducer producer;
    private TextMessage message;

    @PostConstruct
    public void init() throws JMSException {
        MQQueueConnectionFactory mqQueueConnectionFactory = new MQQueueConnectionFactory();
        Connection connection;
        try {
            mqQueueConnectionFactory.setHostName("10.80.33.208");//总线MQ统一入口服务器IP
            mqQueueConnectionFactory.setTransportType(WMQConstants.WMQ_CM_CLIENT);
            mqQueueConnectionFactory.setCCSID(1208);
            mqQueueConnectionFactory.setChannel("ESB.ADMIN.SVRCONN");//总线MQ统一入口通道
            mqQueueConnectionFactory.setPort(40001);//总线MQ统一入口端口
            mqQueueConnectionFactory.setQueueManager("ESB_QM");//总线MQ统一入口队列管理器

            connection = mqQueueConnectionFactory.createConnection();;
            Session session = connection.createSession(false,
                    Session.AUTO_ACKNOWLEDGE);
            javax.jms.Queue queue = session.createQueue("flfj_ersuo_to_txd_queue");//总线MQ统一入口队列名称
            producer = session.createProducer(queue);
            connection.start();
            message = session.createTextMessage();
        } catch (Exception e) {
            e.printStackTrace();

        }

    }


    /**
     * 发送信息至mq
     *
     * @param json
     * @return
     * @throws JMSException
     */
    void sendMQ(String json) throws JMSException {
        message.setText(json);
        producer.send(message);
    }

    /**
     * 发送运单数据
     *
     * @param waybill
     * @param details
     * @return
     */
    public void sendTradeGoodsRiskApi(Waybill waybill, List<WaybillDetail> details) throws JMSException, IOException {
        Long start = System.currentTimeMillis();
        LogEvent event = new LogEvent();
        // 国内
        if (waybill.getDataSource().equalsIgnoreCase("CFPS")) {
            GoodsRisk trade = createMQTrade(waybill, details);
            trade.setFrom("CFPS");
            String json =JsonHelper.getInstance().writeValueAsString(trade);
            log.info("国内运单发送CFPS_MQ request: {}", json);
            this.sendMQ(json);
            event.setApiType("CFPS_MQ运单分类分级发送");
            log.info("国内运单发送CFPS_MQ request success, 耗时: {}ms", System.currentTimeMillis() - start);
        } else if (waybill.getDataSource().equalsIgnoreCase("CSIS")) {
            GoodsRisk trade = createMQTrade(waybill, details);
            trade.setFrom("CSIS");
            String json =JsonHelper.getInstance().writeValueAsString(trade);
            log.info("国内运单发送MQ request: {}", json);
            this.sendMQ(json);
            event.setApiType("MQ运单分类分级发送");
            log.info("国内运单发送MQ request success, 耗时: {}ms", System.currentTimeMillis() - start);
        } else {
            String json =JsonHelper.getInstance().writeValueAsString(createTrade(waybill, details));
            log.info("国际运单发送 request: {}", json);
            String res = HttpUtils.sendPost1(BASE1_URL, json);
            event.setApiType("API运单分类分级发送");
            log.info("国际运单发送 response: {}, 耗时: {}ms", res,
                    System.currentTimeMillis() - start);
        }
        event.setSuccess(true);
        publisher.publishEvent(event);
    }

    @Override
    public String sendTradeGoodsRiskByWaybillApi(String waybillNO,String datasource)   {
        Long start = System.currentTimeMillis();
        LogEvent event = new LogEvent();
        try {
            // 国内
            Waybill waybill = mapper.getByBillno(waybillNO, datasource);
            List<WaybillDetail> details=waybillDetailService.getListByWaybillId(waybill.getId());

            if (waybill.getDataSource().equalsIgnoreCase("CFPS")) {
                GoodsRisk trade = createMQTrade(waybill, details);
                trade.setFrom("CFPS");
                String json =JsonHelper.getInstance().writeValueAsString(trade);
                log.info("国内运单发送CFPS_MQ request: {}", json);
                this.sendMQ(json);
                event.setApiType("CFPS_MQ运单分类分级发送");
                log.info("国内运单发送CFPS_MQ request success, 耗时: {}ms", System.currentTimeMillis() - start);
            } else if (waybill.getDataSource().equalsIgnoreCase("CSIS")) {
                GoodsRisk trade = createMQTrade(waybill, details);
                trade.setFrom("CSIS");
                String json =JsonHelper.getInstance().writeValueAsString(trade);
                log.info("国内运单发送MQ request: {}", json);
                this.sendMQ(json);
                event.setApiType("MQ运单分类分级发送");
                log.info("国内运单发送MQ request success, 耗时: {}ms", System.currentTimeMillis() - start);
            } else {
                String json = JsonHelper.getInstance().writeValueAsString(createTrade(waybill, details));
                log.info("国际运单发送 request: {}", json);
                String res = HttpUtils.sendPost1(BASE1_URL, json);
                log.info("国际运单发送 response: {}, 耗时: {}ms", res,
                        System.currentTimeMillis() - start);
                event.setApiType("API运单分类分级发送");
            }
            event.setSuccess(true);
            publisher.publishEvent(event);
            return "OK";
        } catch (Exception ex) {
            event.setApiType("运单分类分级发送");
            event.setErrorMsg("发生错误，请查看错误日志" + waybillNO + " " +datasource+ ex.getMessage());
            event.setSuccess(false);
            publisher.publishEvent(event);
            log.error("sendTradeGoodsRiskByWaybillApi发送数据失败："+waybillNO +" " +datasource+ ex.getMessage());
            log.error(ex.getMessage());
            return ex.getMessage();
        }
    }



   /* Date StringToDateTime(String strDate)   {

        strDate = strDate.replaceAll("T", " ");
        //SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date dateTime;
        try {
            dateTime = DateUtils.parseDate(strDate, "yyyy-MM-dd HH:mm:ss");
            return dateTime;
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return new Date(1970,0,0);
    }

    Date StringToDateTime(String strDate) {
        strDate = strDate.replaceAll("T", " ");
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date dateTime;
        try {
            dateTime = formatter.parse(strDate);
            return dateTime;
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return new Date(1970,0,0);
    }*/
   Date StringToDate(String strDate) {

       TimeZone.setDefault(TimeZone.getTimeZone("GMT+08:00"));
       strDate = strDate.replaceAll("T", " ");
       SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
       formatter.setTimeZone(TimeZone.getTimeZone("GMT+08:00"));
       Date dateTime;
       try {
           dateTime = formatter.parse(strDate);
           return dateTime;
       } catch (ParseException e) {
           e.printStackTrace();
       }
       return new Date(1970,0,0);
   }

    Date StringToDateTime(String strDate) {
       TimeZone.setDefault(TimeZone.getTimeZone("GMT+08:00"));
        strDate = strDate.replaceAll("T", " ");
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        formatter.setTimeZone(TimeZone.getTimeZone("GMT+08:00"));
        Date dateTime;
        try {
            dateTime = formatter.parse(strDate);
            return dateTime;
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return new Date(1970,0,0);
    }
    /**
     * 货物风险等级
     * 1 低风险
     * 2 普通
     * 3 高风险
     * 综合风险等级
     * 1 低风险
     * 2 优先
     * 3 普通
     * 4 高风险
     * 5 严控
     */
    @Override
    @Transactional(readOnly = false)
    public void handleBatchWaybill(Integer limit) {
        // 获取未处理运单数据，一次处理一百条
        List<Waybill> list = mapper.getUnHandleBillList(limit);
        for (Waybill waybill : list) {
            this.handleWaybill(waybill);
        }
    }

    @Override
    @Transactional(readOnly = false)
    public void handleWaybill(Waybill waybill) {
        Long start = System.currentTimeMillis();
        log.info("开始执行运单处理: {}", JSON.toJSONString(waybill));
        waybill.setStatus(1);
        waybill.preUpdate();
        /**
         * 1、校验数据
         * 2、查询航班是否属于重点航班或者航线
         * 3、查询代理人信用等级
         * 4、分词
         */
        if (StringUtils.isBlank(waybill.getAgentCode()) || StringUtils.isBlank(waybill.getGoodsName())) {
            waybill.setStatus(2);
            mapper.update(waybill);
            return;
        }
        waybill.setIsImportantFlights("N");
        if (StringUtils.isNotBlank(waybill.getFlightNo())) {
            // 判断是否是重点航班
            SyncEmergencyFlight airport = this.queryEmergencyFlight(waybill);
            if ("1".equals(airport.getStartupDisable())) {
                waybill.setIsImportantFlights("Y");
            }
        }

        Agent agent = queryDBTradeAgentLevel(waybill);
        String level="";
        if(agent!=null){
            level=agent.getAgentLevel();
        }
        if (agent==null && StringUtils.isNotBlank(waybill.getAgentCode()) && StringUtils.isNotBlank(waybill.getOrganization())) {
            try {
                // 查询代理人信用等级
                resultResponseT<wlpt_agent_scoreResponse> infos = this.queryTradeAgentLevel(waybill);
                if (infos != null && infos.getData() != null && !infos.getData().isEmpty()) {
                    List<wlpt_agent_scoreResponse> data = infos.getData();
                    wlpt_agent_scoreResponse target = data.get(0);
                    if (data.size() > 1) {
                        target = data.stream().sorted(Comparator.comparing(wlpt_agent_scoreResponse::getYear,
                                Comparator.reverseOrder()).thenComparing(wlpt_agent_scoreResponse::getQuarter,
                                Comparator.reverseOrder())).findFirst().get();
                    }
                    if (!StringUtils.isEmpty(target.getLevel())) {
                        level = target.getLevel();
                    }
                }
            } catch (Exception ex) {
                ex.printStackTrace();
//                apiLogService.updateError("查询代理人信用等级");
            }
        }

        waybill.setAgentLevel(level);

        if (StringUtils.isEmpty(waybill.getAgentLevel())){
            waybill.setAgentLevel(defaultAgentLevel);
        }
        Boolean diffRecord = Boolean.FALSE;
        try{
            // 获取差异化备案记录
            resultResponseT<wlpt_diff_producet_queryResponse> res = this.queryDiffProducetCommonLevel(waybill);

            if (res != null && res.getData() != null && !res.getData().isEmpty()) {
                for (wlpt_diff_producet_queryResponse datum : res.getData()) {
                    if (datum != null && datum.isCompare()) {
                        diffRecord = Boolean.TRUE;
                        break;
                    }
                }
            }
        } catch (Exception ex){
            ex.printStackTrace();
//            apiLogService.updateError("获取差异化备案记录");
        }
        // 进行分词
        List<String> words = nlpService.getCutList(waybill.getGoodsName());
        if (words.isEmpty()) {
            waybill.setStatus(2);
            mapper.update(waybill);
            return;
        }
        List<WaybillDetail> details = new ArrayList<>();
        // 生成明细记录
        for (String word : words) {
            WaybillDetail detail = new WaybillDetail();
            detail.setTradeName(word);
            detail.setTradeNameKey(word);
            detail.setWaybillId(waybill.getId());
            // 计算货物风险等级
            // 判断是否重点航班或者航线
            if ("Y".equals(waybill.getIsImportantFlights())) {
                detail.setTradeRiskClassification("高风险");
            } else {
                // 判断差异化备案记录，在备案中返回低风险，否则返回普通风险
                if (diffRecord) {
                    detail.setTradeRiskClassification("低风险");
                } else {
                    // 判断清单中有没有数据，有的话返回高风险
                    CargoDetail cargoDetail = cargoDetailService.getByName(word);
                    if (cargoDetail == null) {
                        detail.setTradeType("0");
                        detail.setTradeRiskClassification("普通");
                    } else {
                        detail.setTradeType(cargoDetail.getType().toString());
                        detail.setTradeRiskClassification("高风险");
                    }
                }
            }
            // 计算综合货物风险
            switch (detail.getTradeRiskClassification()) {
                case "高风险":
                    detail.setTradeRiskRating("高风险");
                    break;
                case "普通":
                    switch (waybill.getAgentLevel()) {
                        case "A":
                            detail.setTradeRiskRating("优先");
                            break;
                        case "B":
                            detail.setTradeRiskRating("普通");
                            break;
                        case "C":
                            detail.setTradeRiskRating("严控");
                            break;
                        default:
                            detail.setTradeRiskRating("高风险");
                    }
                    break;
                default:
                    switch (waybill.getAgentLevel()) {
                        case "A":
                            detail.setTradeRiskRating("低风险");
                            break;
                        case "B":
                            detail.setTradeRiskRating("普通");
                            break;
                        default:
                            detail.setTradeRiskRating("严控");
                    }
            }
            waybillDetailService.save(detail);
            details.add(detail);
        }
        // 计算运单的货物风险等级和综合风险等级
        if (details.stream().filter(row -> "高风险".equals(row.getTradeRiskClassification())).count() > 0) {
            waybill.setRiskClassification("高风险");
        } else if (details.stream().filter(row -> "低风险".equals(row.getTradeRiskClassification())).count() > 0) {
            waybill.setRiskClassification("低风险");
        } else {
            waybill.setRiskClassification("普通");
        }
        if (details.stream().filter(row -> "高风险".equals(row.getTradeRiskRating())).count() > 0) {
            waybill.setRiskRating("高风险");
        } else if (details.stream().filter(row -> "严控".equals(row.getTradeRiskRating())).count() > 0) {
            waybill.setRiskRating("严控");
        } else if (details.stream().filter(row -> "普通".equals(row.getTradeRiskRating())).count() > 0) {
            waybill.setRiskRating("普通");
        } else if (details.stream().filter(row -> "优先".equals(row.getTradeRiskRating())).count() > 0) {
            waybill.setRiskRating("优先");
        } else {
            waybill.setRiskRating("低风险");
        }
        mapper.update(waybill);
        try {
            this.sendTradeGoodsRiskApi(waybill, details);
            waybill.setSendStatus(1);
            mapper.update(waybill);
        } catch (Exception e) {
            e.printStackTrace();
        }
        log.info("完成执行运单处理, 运单号: {}, 耗时: {}", waybill.getWaybillNo(),  System.currentTimeMillis() - start);
    }

    @Override
    public void handleSendWaybill(Integer limit) {
        List<Waybill> list = mapper.getUnSendBillList(limit);
        for (Waybill waybill : list) {
            List<WaybillDetail> details = waybillDetailService.getListByWaybillId(waybill.getId());
            try {
                this.sendTradeGoodsRiskApi(waybill, details);
                waybill.setSendStatus(1);
                mapper.update(waybill);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }


    @Override
    public resultResponseT<airlineCargoResponse> queryAirlineCargo(airlineCargoRequest info) {
        resultResponseT<airlineCargoResponse> result = new resultResponseT<airlineCargoResponse>();
        List<airlineCargoResponse> datas = new ArrayList<airlineCargoResponse>();
        List<airlineCargoResponseItem> items= waybillDetailService.queryAirlineCargo(info);
        Map<String,List<airlineCargoResponseItem>> responseDictionary = new HashMap<>();
        for (int i = 0; i < items.size(); i++) {
            airlineCargoResponseItem item = items.get(i);
            if(!responseDictionary.containsKey(item.flight)){
                responseDictionary.put(item.flight,new ArrayList<airlineCargoResponseItem>());
            }
            List<airlineCargoResponseItem> arrayList  = responseDictionary.get(item.flight);
            arrayList.add(item);
        }
        for (String flight :responseDictionary.keySet()) {
            airlineCargoResponse data = new airlineCargoResponse();
            data.setFlightLine(flight);
            List<airlineCargoResponseItem> itemList = responseDictionary.get(flight);
            Integer c = 0;
            for (int i = 0; i <itemList.size() ; i++) {
                airlineCargoResponseItem item=itemList.get(i);
                if(item.count==null)
                    item.count=0;
                c = item.count+c;
            }


            String[] levels ={"低风险","优先","普通","高风险","严控"};
            for (int i = 0; i < 5; i++) {
                String level = levels[i];
                if(!itemList.stream().anyMatch(t->t.level!=null && t.level.equals(level))){
                    itemList.add(new airlineCargoResponseItem(level,0));
                }
            }
            data.setCount(c);
            data.setDatas(itemList);
            datas.add(data);
        }
        result.setData(datas);
        return result;
    }


    @Override
    public resultResponseT<airlineCargoResponse> queryAirlinePieceCargo(airlineCargoRequest info) {
        resultResponseT<airlineCargoResponse> result = new resultResponseT<airlineCargoResponse>();
        List<airlineCargoResponse> datas = new ArrayList<airlineCargoResponse>();
        List<airlineCargoResponseItem> items= waybillDetailService.queryAirlinePieceCargo(info);
        Map<String,List<airlineCargoResponseItem>> responseDictionary = new HashMap<>();
        for (int i = 0; i < items.size(); i++) {
            airlineCargoResponseItem item = items.get(i);
            if(!responseDictionary.containsKey(item.flight)){
                responseDictionary.put(item.flight,new ArrayList<airlineCargoResponseItem>());
            }
            List<airlineCargoResponseItem> arrayList  = responseDictionary.get(item.flight);
            arrayList.add(item);
        }
        for (String flight :responseDictionary.keySet()) {
            airlineCargoResponse data = new airlineCargoResponse();
            data.setFlightLine(flight);
            List<airlineCargoResponseItem> itemList = responseDictionary.get(flight);
            Integer c = 0;
            for (int i = 0; i <itemList.size() ; i++) {
                airlineCargoResponseItem item=itemList.get(i);
                if(item.count==null)
                    item.count=0;
                c = item.count+c;
            }


            String[] levels ={"低风险","优先","普通","高风险","严控"};
            for (int i = 0; i < 5; i++) {
                String level = levels[i];
                if(!itemList.stream().anyMatch(t->t.level!=null && t.level.equals(level))){
                    itemList.add(new airlineCargoResponseItem(level,0));
                }
            }
            data.setCount(c);
            data.setDatas(itemList);
            datas.add(data);
        }
        result.setData(datas);
        return result;
    }


    @Override
    public resultResponseT<securityCheckResponse> querySecurityCheck(securityCheckRequest info) {
        resultResponseT<securityCheckResponse> result = new resultResponseT<securityCheckResponse>();
        List<securityCheckResponse> datas = new ArrayList<securityCheckResponse>();
        List<securityCheckResponseItem> items= waybillDetailService.querySecurityCheck(info);

        Map<String,List<securityCheckResponseItem>> responseDictionary = new HashMap<>();
        for (int i = 0; i < items.size(); i++) {
            securityCheckResponseItem item = items.get(i);
            if(!responseDictionary.containsKey(item.channel)){
                responseDictionary.put(item.channel,new ArrayList<securityCheckResponseItem>());
            }
            List<securityCheckResponseItem> arrayList  = responseDictionary.get(item.channel);
            arrayList.add(item);
        }
        for (String channel :responseDictionary.keySet()) {
            securityCheckResponse data = new securityCheckResponse();
            data.setChannel(channel);
            List<securityCheckResponseItem> itemList = responseDictionary.get(channel);
            Integer c = 0;
            for (int i = 0; i <itemList.size() ; i++) {
                securityCheckResponseItem item=itemList.get(i);
                if(item.count==null)
                    item.count=0;
                c = item.count+c;
            }

            String[] levels ={"低风险","优先","普通","高风险","严控"};
            for (int i = 0; i < 5; i++) {
                String level = levels[i];
                if(!itemList.stream().anyMatch(t->t.level!=null &&t.level.equals(level))){
                    itemList.add(new securityCheckResponseItem(level,0));
                }
            }

            data.setCount(c);
            data.setDatas(itemList);
            datas.add(data);
        }

        result.setData(datas);
        return result;


    }

    @Override
    public resultResponseT<agentCreditResponse> queryAgentCredit(agentCreditRequest info) {
        resultResponseT<agentCreditResponse> result = new resultResponseT<agentCreditResponse>();
        List<agentCreditResponse> datas = new ArrayList<agentCreditResponse>();
        List<agentCreditResponseItem> items= waybillDetailService.queryAgentCredit(info);

        Map<String,List<agentCreditResponseItem>> responseDictionary = new HashMap<>();
        for (int i = 0; i < items.size(); i++) {
            agentCreditResponseItem item = items.get(i);
            if(!responseDictionary.containsKey(item.date)){
                responseDictionary.put(item.date,new ArrayList<agentCreditResponseItem>());
            }
            List<agentCreditResponseItem> arrayList  = responseDictionary.get(item.date);
            arrayList.add(item);
        }

        for (String date :responseDictionary.keySet()) {
            agentCreditResponse data = new agentCreditResponse();
            data.setDate(date);
            List<agentCreditResponseItem> itemList = responseDictionary.get(date);
            Integer c = 0;
            for (int i = 0; i <itemList.size() ; i++) {
                agentCreditResponseItem item=itemList.get(i);
                if(item.count==null)
                    item.count=0;
                c = item.count+c;
            }

            String[] levels ={"A","B","C","D"};
            for (int i = 0; i < 4; i++) {
                String level = levels[i];
                if(!itemList.stream().anyMatch(t->t.level!=null && t.level.equals(level))){
                    itemList.add(new agentCreditResponseItem(level,0));
                }
            }

            data.setCount(c);
            data.setDatas(itemList);
            datas.add(data);
        }


        result.setData(datas);
        return result;




    }

    @Override
    public resultResponseT<String> queryAirline() {
        resultResponseT<String> result = new resultResponseT<String>();

        List<String> items= waybillDetailService.queryAirline();
        result.setData(items);
        return result;
    }

}
